//
//  LZLoginModel.swift
//  halikaPeso
//
//  Created by L-zh on 2024/12/17.
//

import UIKit
import ObjectMapper

class LZLoginModel: NSObject,Mappable,NSCoding {
    required init?(coder aDecoder: NSCoder) {
        super.init()
        pwdResetStaus = aDecoder.decodeObject(forKey: "pwdResetStaus") as? Int
        token = aDecoder.decodeObject(forKey: "token") as? String
        type = aDecoder.decodeObject(forKey: "type") as? Int
        userId = aDecoder.decodeObject(forKey: "userId") as? Int
        type = aDecoder.decodeObject(forKey: "type") as? Int
        userName = aDecoder.decodeObject(forKey: "userName") as? String
        companyType = aDecoder.decodeObject(forKey: "companyType") as? Int
        amountType = aDecoder.decodeObject(forKey: "amountType") as? Int
        companyName = aDecoder.decodeObject(forKey: "companyName") as? String
        companyId = aDecoder.decodeObject(forKey: "companyId") as? Int
        businessId = aDecoder.decodeObject(forKey: "businessId") as? Int
    }
    
    required init?(map: ObjectMapper.Map) {
        
    }
    
    func encode(with coder: NSCoder) {
        coder.encode(pwdResetStaus, forKey: "pwdResetStaus")
        coder.encode(token, forKey: "token")
        coder.encode(type, forKey: "type")
        coder.encode(userId, forKey: "userId")
        coder.encode(userName, forKey: "userName")
        coder.encode(companyId, forKey: "companyId")
        coder.encode(companyType, forKey: "companyType")
        coder.encode(amountType, forKey: "amountType")
        coder.encode(companyName, forKey: "companyName")
        coder.encode(companyId, forKey: "companyId")
        coder.encode(businessId, forKey: "businessId")
    }
    
    func mapping(map: Map) {
        pwdResetStaus <- map["pwdResetStaus"]
        token <- map["token"]
        type <- map["type"]
        userId <- map["userId"]
        userName <- map["userName"]
        companyId <- map["companyId"]
        companyType <- map["companyType"]
        amountType <- map["amountType"]
        companyName <- map["companyName"]
        businessId <- map["businessId"]
    }
    
    /// 是否修改过密码 (老板首次登陆是否重置过密码（0：未修改 1：已修改）)
    var pwdResetStaus: Int?
    /// 登录安全码
    var token: String?
    /// 用户类型 (用户类型 (0:员工 1:老板 ))
    var type: Int?
    /// 用户id (数据类型：long)
    var userId: Int?
    /// 用户名字
    var userName: String?
    /// 公司id
    var companyId: Int?
    /// 公司名称
    var companyName: String?
    /// 公司类型（0：普通 1：付费）
    var companyType: Int?
    /// 公司类型（0：体验用户，1：正常）
    var amountType: Int?
    ///总店id
    var businessId:Int?
}
